//模块接口文件，暴露给外部使用
import { request } from "./core";
import URL from "./url";
import METHOD from "./methods";

const APIClient = {
  install(Vue) {
    Vue.prototype.$API = this;
  },

  /**
   *
   * @param {*} name
   */
  List() {
    return request(METHOD.GET, URL.STORELIST);
  },

  /**
   *
   * @param {*} title
   * @param {*} descript
   * @param {*} pic
   * @param {*} uid
   */
  XQ() {
    return request(METHOD.GET, URL.ZHUANTI);
  },
  /**
   *
   */
  deali(id) {
    return request(METHOD.GET, URL.XIANGQING + `?id=${id}`);
  },
  shop() {
    return request(METHOD.POST, URL.SHOP);
  },
  comdet(id) {
    return request(METHOD.POST, URL.COMMODITYDETAILS + `?id=${id}`);
  },
  evaluate(id) {
    return request(METHOD.POST, URL.EVALUATE + `?goodsId=${id}`);
  },
  sigin(mobile, pwd) {
    return request(METHOD.POST, URL.SIGNIN + `&mobile=${mobile}&pwd=${pwd}`);
  },
  /***
   * 
   */
  address(address,cityId,code,linkMan,mobile,provinceId,token) {
    return request(METHOD.POST, URL.ADDRESS ,{
     params:{
      address:address,
      cityId:cityId,
      code:code,
      linkMan:linkMan,
      mobile:mobile,
      provinceId:provinceId,
      token:token
     }
    });
  },
};
export default APIClient;
